<template>
  <div>
    <h1>二维码生成</h1>
    <pre>
        qrcode
        1:下载  yarn add qrcode
        2:导入  import Qrcode from 'qrcode'
        3:创建canvas标签
            canvas  ref="canvas"
        4：生成二维码
            Qrcode.toCanvas(生成二维码的dom（this.$refs.canvas）,'需要生成二维码的数据',{
                width,
                height....
            })
    </pre>
    <canvas ref="canvas" />
    <el-button type="primary" @click="btnClick">点击生成二维码</el-button>
  </div>
</template>
<script>
import Qrcode from 'qrcode'
export default {
  methods: {
    btnClick() {
      Qrcode.toCanvas(this.$refs.canvas, 'https://www.baidu.com/', {
        width: 600,
        height: 600
      })
    }
  }
}
</script>
<style></style>
